<?php

/**
 * JCLIC_GROUPS form base class.
 *
 * @method JCLIC_GROUPS getObject() Returns the current form's model object
 *
 * @package    Projecte Final de Carrera
 * @subpackage form
 * @author     Jaume Fernandez
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseJCLIC_GROUPSForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'group_id'          => new sfWidgetFormInputHidden(),
      'group_name'        => new sfWidgetFormInputText(),
      'group_description' => new sfWidgetFormInputText(),
      'group_icon'        => new sfWidgetFormInputText(),
      'group_code'        => new sfWidgetFormInputText(),
      'group_keywords'    => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'group_id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('group_id')), 'empty_value' => $this->getObject()->get('group_id'), 'required' => false)),
      'group_name'        => new sfValidatorString(array('max_length' => 80, 'required' => false)),
      'group_description' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'group_icon'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'group_code'        => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'group_keywords'    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('jclic_groups[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'JCLIC_GROUPS';
  }

}
